<?php
/**
 * Created by PhpStorm.
 * User: Administrator
 * Date: 2015/7/14
 * Time: 17:16
 */

$user = $_POST['user'];

//var_dump($user);
//exit;

$db_host = "localhost";
$db_user = "root";
$db_psw = "root";
$db_name = "login_test";

$mysqli = new Mysqli();

$mysqli->connect($db_host, $db_user, $db_psw, $db_name);

$query = "SELECT COUNT(*)FROM user WHERE user_name = '" . $user['name'] . "' AND PASSWORD = '" . md5($user['password']) . "'";
//$result = $mysqli->query($query);

//if($result > 0){
//    header("Location: home.php");
//} else {
//    header("Location: login.html");
//}

//var_dump($result);
echo "<pre>";
var_dump($mysqli->connect($db_host, $db_user, $db_psw, $db_name));
var_dump(count($result));
var_dump($result);
var_dump($user['name']);
var_dump($user['password']);
//var_dump($result->num_rows);
var_dump($query);
exit;

$mysqli->close();
?>